﻿<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="bean.User"%>
<%@ page import="bean.Right"%>
<%@ page import="java.util.List"%>
<%
	User user = (User) request.getSession().getAttribute("user");
	List<Right> type1 = (List) request.getSession().getAttribute("type1");
	List<Right> type2 = (List) request.getSession().getAttribute("type2");
	List<Right> type3 = (List) request.getSession().getAttribute("type3");
	List<Right> type4 = (List) request.getSession().getAttribute("type4");
%>
<!DOCTYPE html>
<head>
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<meta name="format-detection" content="telephone=no">
<meta charset="UTF-8">

<meta name="description" content="Violate Responsive Admin Template">
<meta name="keywords" content="Super Admin, Admin, Template, Bootstrap">

<title>车辆缉查管理系统-人员信息</title>

<!-- CSS -->
<link href="zhu/css/bootstrap.min.css" rel="stylesheet">
<link href="zhu/css/animate.min.css" rel="stylesheet">
<link href="zhu/css/font-awesome.min.css" rel="stylesheet">
<link href="zhu/css/form.css" rel="stylesheet">
<link href="zhu/css/calendar.css" rel="stylesheet">
<link href="zhu/css/style.css" rel="stylesheet">
<link href="zhu/css/icons.css" rel="stylesheet">
<link href="zhu/css/generics.css" rel="stylesheet">
<link rel="stylesheet" href="css/ssi-uploader.min.css" />
<link rel="stylesheet" type="text/css"
	href="css/bootstrap-datepicker3.min.css">
</head>

<body id="skin-blur-violate">
	<header id="header" class="media">
		<a href="" id="menu-toggle"></a> <a class="logo pull-left"
			href="toIndex">车辆缉查管理</a>
		<div class="media-body">
			<div class="media" id="top-menu">
				<div id="time" class="pull-right">
					<span id="hours"></span> : <span id="min"></span> : <span id="sec"></span>
				</div>
			</div>
		</div>
	</header>

	<div class="clearfix"></div>
	<section id="main" class="p-relative" role="main">
		<!-- Sidebar -->
		<aside id="sidebar">
			<!-- Sidbar Widgets -->
			<div class="side-widgets overflow">
				<!-- Profile Menu -->
				<div class="text-center s-widget m-b-25 dropdown" id="profile-menu">
					<a href="" data-toggle="dropdown"> <img
						class="profile-pic animated" src="zhu/img/profile-pic.jpg" alt="">
					</a>
					<ul class="dropdown-menu profile-menu">
						<li><a href="logout">注销用户</a> <i class="icon left">&#61903;</i><i
							class="icon right">&#61815;</i></li>
					</ul>
					<h4 class="m-0"><%=user.getUserName()%></h4>

				</div>

				<!-- Calendar -->
				<div class="s-widget m-b-25">
					<div id="sidebar-calendar"></div>
				</div>

				<!-- Projects -->

				<div class="s-widget-body"></div>
			</div>

			<!-- Side Menu -->
			<ul class="list-unstyled side-menu">
				<li class="active"><a class="sa-side-home" href="toIndex">
						<span class="menu-item">主页</span>
				</a></li>
				<%
					if (!type1.isEmpty()) {
				%>

				<li class="dropdown"><a class="sa-side-ui" href=""> <span
						class="menu-item">卡口系统</span>
				</a>
					<ul class="list-unstyled menu-item">
						<%
							for (Right right : type1) {
						%>
						<li><a href="<%=right.getHref()%>"><%=right.getRightName()%></a></li>
						<%
							}
						%>
					</ul></li>
				<li>
					<%
						}
						if (!type2.isEmpty()) {
					%>
				
				<li class="dropdown"><a class="sa-side-widget" href=""> <span
						class="menu-item">车辆缉查</span>
				</a>
					<ul class="list-unstyled menu-item">
						<%
							for (Right right : type2) {
						%>
						<li><a href="<%=right.getHref()%>"><%=right.getRightName()%></a></li>
						<%
							}
						%>
					</ul></li>
				<li>
					<%
						}
						if (!type3.isEmpty()) {
					%>
				
				<li class="dropdown"><a class="sa-side-form" href=""> <span
						class="menu-item">资源管理</span>
				</a>
					<ul class="list-unstyled menu-item">
						<%
							for (Right right : type3) {
						%>
						<li><a href="<%=right.getHref()%>"><%=right.getRightName()%></a></li>
						<%
							}
						%>
					</ul></li>
				<%
					}
					if (!type4.isEmpty()) {
				%>
				<li class="dropdown"><a class="sa-side-ui" href=""> <span
						class="menu-item">系统管理</span>
				</a>
					<ul class="list-unstyled menu-item">
						<%
							for (Right right : type4) {
						%>
						<li><a href="<%=right.getHref()%>"><%=right.getRightName()%></a></li>
						<%
							}
						%>
					</ul> <%
 	}
 %></li>
			</ul>
		</aside>

		<!-- Content -->
		<section id="content" class="container">

			<!-- Breadcrumb -->
			<ol class="breadcrumb hidden-xs">
				<li class="active"><a href="toIndex">主页</a></li>
				<li><a href="logout">注销用户</a></li>
			</ol>

			<h4 class="page-title">人员信息</h4>

			<!-- main content -->

			<div class="tile">
				<h2 class="tile-title">人员信息</h2>

				<div style="widht: 1000px">
					<div style="float: left; width: 400px">
						<p class="m-t-20">用户名:</p>
						<label for="main_userName"><%=user.getUserName()%></label>
						<p class="m-t-20">人员id:</p>
						<label for="main_id"><%=user.getUserId()%></label>
						<p class="m-t-20">真实姓名:</p>
						<label for="main_relName"><%=user.getTruename()%></label>
						<p class="m-t-20">性别:</p>
						<label for="main_sex"><%=user.getSex()%></label>
						<p class="m-t-20">生日:</p>
						<label id="birthday" for="main_age"><%=user.getBirthday()%></label>
						<p class="m-t-20">联系方式:</p>
						<label for="main_idCard"><%=user.getPhoneNumber()%></label>
						<p class="m-t-20">角色:</p>
						<label for="main_idCard"><%=user.getRole().getRoleName() %></label>
					</div>

					<div style="float: right; width: 400px">
						<p class="m-t-20">用户照片:</p>
						<img id="userPhoto" src="<%=user.getImg()%>" alt="头像"
							onclick="clickPhoto()" /> <input type="text"
							style="visibility: hidden; width: 400px; height: 400px;" />

						<button type="button"
							class="btn btn-primary contact_button wow fadeInUp"
							onclick='edit()'>
							<i class="fa fa-send-o"></i> 编辑
						</button>
						<button class="btn btn-primary contact_button wow fadeInUp">
							<a href="toIndex"><i class="fa fa-send-o"></i> 返回</a>
						</button>

					</div>
				</div>
			</div>
			<!-- dialog -->
			<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
				aria-labelledby="myModalLabel">
				<div class="modal-dialog" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
								aria-label="Close">
								<span aria-hidden="true">×</span>
							</button>
							<h4 class="modal-title" id="myModalLabel">编辑</h4>
						</div>
						<div class="modal-body">
							<div class="form-group">
								<label for="edit_relName">真实姓名</label> <input type="text"
									name="edit_relName" class="form-control" id="edit_relName"
									placeholder="<%=user.getTruename()%>">
							</div>
							<div class="form-group">
								<label for="edit_sex">性别</label> <input type="text"
									name="edit_sex" class="form-control" id="edit_sex"
									placeholder="<%=user.getSex()%>">
							</div>
							<div class="form-group">
								<label for="txt_statu">联系方式</label> <input type="number"
									name="edit_phone" class="form-control" id="edit_phone"
									placeholder="<%=user.getPhoneNumber()%>">
							</div>
							<div class="form-group  date datepicker"
								data-date="<%=user.getBirthday()%>">
								<label for="txt_statu">生日</label> <input type="text"
									id="edit_birthday" class="form-control"
									placeholder="<%=user.getBirthday()%>" readonly>
							</div>

						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default"
								data-dismiss="modal">
								<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭
							</button>
							<button type="button"
								class="btn btn-primary contact_button wow fadeInUp"
								onclick='save()'>
								<span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>保存
							</button>
						</div>
					</div>
				</div>
			</div>

			<!-- PhotoDialog -->
			<div class="modal fade" id="myPhotoModal" tabindex="-1" role="dialog"
				aria-labelledby="myPhotoModalLabel">
				<div class="modal-dialog" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
								aria-label="Close">
								<span aria-hidden="true">×</span>
							</button>
							<h4 class="modal-title" id="myModalLabel">编辑</h4>
						</div>
						<div class="modal-body">

							<div class="form-group">
								<label for="txt_statu">用户照片</label> <input type="file" multiple
									id="ssi-upload" />
							</div>
						</div>
					</div>
				</div>
			</div>

		</section>

	</section>

	<!-- Javascript Libraries -->
	<!-- jQuery -->
	<script src="zhu/js/jquery.min.js"></script>
	<!-- jQuery Library -->
	<script src="zhu/js/jquery-ui.min.js"></script>
	<!-- jQuery UI -->
	<script src="zhu/js/jquery.easing.1.3.js"></script>
	<!-- jQuery Easing - Requirred for Lightbox + Pie Charts-->

	<!-- Bootstrap -->
	<script src="zhu/js/bootstrap.min.js"></script>

	<!-- Charts -->
	<script src="zhu/js/charts/jquery.flot.js"></script>
	<!-- Flot Main -->
	<script src="zhu/js/charts/jquery.flot.time.js"></script>
	<!-- Flot sub -->
	<script src="zhu/js/charts/jquery.flot.animator.min.js"></script>
	<!-- Flot sub -->
	<script src="zhu/js/charts/jquery.flot.resize.min.js"></script>
	<!-- Flot sub - for repaint when resizing the screen -->

	<script src="zhu/js/sparkline.min.js"></script>
	<!-- Sparkline - Tiny charts -->
	<script src="zhu/js/easypiechart.js"></script>
	<!-- EasyPieChart - Animated Pie Charts -->
	<script src="zhu/js/charts.js"></script>
	<!-- All the above chart related functions -->

	<!-- Map -->
	<script src="zhu/js/maps/jvectormap.min.js"></script>
	<!-- jVectorMap main library -->
	<script src="zhu/js/maps/usa.js"></script>
	<!-- USA Map for jVectorMap -->

	<!--  Form Related -->
	<script src="zhu/js/icheck.js"></script>
	<!-- Custom Checkbox + Radio -->

	<!-- UX -->
	<script src="zhu/js/scroll.min.js"></script>
	<!-- Custom Scrollbar -->

	<!-- Other -->
	<script src="zhu/js/calendar.min.js"></script>
	<!-- Calendar -->
	<script src="zhu/js/feeds.min.js"></script>
	<!-- News Feeds -->
	<script src="js/ssi-uploader.min.js"></script>
	<script type="text/javascript" src="js/bootstrap-datepicker.min.js"></script>
	<!-- All JS functions -->
	<script src="zhu/js/functions.js"></script>
	<script src="js/layer.js"></script>
	<script type="text/javascript">
		$('.datepicker').datepicker({
			format : 'yyyy-mm-dd',
		});
		$('datepicker').datepicker('update', '1997-06-09');
		$('#ssi-upload').ssi_uploader({
			url : 'fileRecieve',
			maxNumberOfFiles : 1,
			allowed : [ 'jpg', 'gif', 'txt', 'png', 'pdf' ],
			ajaxOptions : {
				type : 'post',
				success : function onSuccess(data) {
					layer.msg('文件上传成功！');
					$(userPhoto).attr("src", data.url);
					$('#myPhotoModal').modal('hide');
				}
			}
		});

		function edit() {
			$("#myModalLabel").text("编辑");
			$('#myModal').modal();
		};

		function save() {
			var index = layer.load(1, {
				shade : [ 0.1, '#fff' ]
			//0.1透明度的白色背景
			});
			var realName = $("#edit_relName");
			var sex = $("#edit_sex");
			var phoneNum = $("#edit_phone");
			var birthday = $("#edit_birthday");
			$.ajax({
				url : "privateManagerModify",
				type : "post",
				data : {
					realName : realName.val(),
					sex : sex.val(),
					phoneNum : phoneNum.val(),
					birthday : birthday.val()
				},
				success : function onSuccess(data) {
					layer.msg('信息修改成功');
					$('#myModal').modal('hide');
					$("#birthday").html(data.birthday)
				}
			});
		};

		<!--上传图片-->
		function clickPhoto() {
			$("#myPhotoModalLabel").text("更改图片");
			$('#myPhotoModal').modal();
		}
		
		function loading() {
			var index = layer.load(1, {
				shade : [ 0.1, '#fff' ]
			//0.1透明度的白色背景
			});
			layer.msg('页面正在加载中,请稍后');
		}
	</script>
</body>

</html>